package com.lz.ovuola.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * 
 * 用户模型
 * 
 * @author fz
 *
 */
@Table(name = "user", uniqueConstraints = { @UniqueConstraint(columnNames = { "id" }) })
@Entity(name = "userDo")
public class UserDo extends BaseDo {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1911943927210806111L;
	@Id
	@GeneratedValue
	private Integer id;
	/**
	 * 手机号
	 */
	@Column(name = "user_name", length = 11, nullable = true)
	private String userName;
	/**
	 * 密码
	 */
	@Column(name = "password", nullable = true)
	private String password;
	/**
	 * 第三方登陆唯一标识
	 */
	@Column(name = "app_id")
	private String appId;
	/**
	 * 昵称
	 */
	@Column(name = "nick_name")
	private String nickName;
	/**
	 * 头像
	 */
	@Column(name = "head_image")
	private String headImage;
	/**
	 * 用户状态 1：正常 2：冻结
	 */
	@Enumerated(EnumType.STRING)
	@Column(name = "status")
	private UserStatus status;
	/**
	 * 登陆来源 1：手机号 2：微信 3：qq 4：微博
	 */
	@Column(name = "source")
	private Integer source;

	/**
	 * 客户端设备
	 */
	@Column(name = "device")
	private String device;

	/**
	 * 硬件设备
	 */
	@Column(name = "hardware_equipment")
	private String hardwareEquipment;
	/**
	 * 年龄
	 */
	@Column(name = "age")
	private Integer age;
	/**
	 * 地址
	 */
	@Column(name = "address")
	private Integer address;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time")
	private Date createTime;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time")
	private Date updateTime;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "binding_time")
	private Date bindingTime;

	public UserDo() {
		super();
	}

	public UserDo(String userName, String password, String nickName,
			String device) {
		super();
		this.userName = userName;
		this.password = password;
		this.nickName = nickName;
		this.device = device;
		this.source = 1;// 手机号
		this.status = UserStatus.NORMAL;
		this.createTime = new Date();
		this.updateTime = new Date();
	}

	public UserDo(String appId, String nickName, String headImage,
			Integer source, String device) {
		super();
		this.appId = appId;
		this.nickName = nickName;
		this.headImage = headImage;
		this.source = source;
		this.device = device;
		this.status = UserStatus.NORMAL;
		Date now = new Date();
		this.createTime = now;
		this.updateTime = now;
	}

	public UserDo(String userName, String password, String appId,
			String nickName, String headImage, Integer status, Integer source,
			String device, String hardwareEquipment, Integer age,
			Integer address, Date createTime, Date updateTime) {
		super();
		this.userName = userName;
		this.password = password;
		this.appId = appId;
		this.nickName = nickName;
		this.headImage = headImage;
		this.status = UserStatus.NORMAL;
		this.source = source;
		this.device = device;
		this.hardwareEquipment = hardwareEquipment;
		this.age = age;
		this.address = address;
		this.createTime = createTime;
		this.updateTime = updateTime;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getHeadImage() {
		return headImage;
	}

	public void setHeadImage(String headImage) {
		this.headImage = headImage;
	}

	public UserStatus getStatus() {
		return status;
	}

	public void setStatus(UserStatus status) {
		this.status = status;
	}

	public Integer getSource() {
		return source;
	}

	public void setSource(Integer source) {
		this.source = source;
	}

	public String getDevice() {
		return device;
	}

	public void setDevice(String device) {
		this.device = device;
	}

	public String getHardwareEquipment() {
		return hardwareEquipment;
	}

	public void setHardwareEquipment(String hardwareEquipment) {
		this.hardwareEquipment = hardwareEquipment;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public Integer getAddress() {
		return address;
	}

	public void setAddress(Integer address) {
		this.address = address;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Date getBindingTime() {
		return bindingTime;
	}

	public void setBindingTime(Date bindingTime) {
		this.bindingTime = bindingTime;
	}

}
